package net.sevear.chaos
{
	import com.adobe.serialization.json.JSON;
	
	import flash.display.JointStyle;

	public class DBRadioChannelParser
	{
		public static var channelInfo:Object = null;
		public static function parseChannels(html:String):void{
			var publicChannelMatchRst:Array = html.match(/var channelInfo = {["a-zA-Z\d:\[\],{_\/\u4E00-\u9FA5\uf900-\ufa2d\/}&’?! ]*}/g);
			if(publicChannelMatchRst!=null && publicChannelMatchRst.length>0){
				var channelsStartIdx:int = (publicChannelMatchRst[0] as String).search(/{/);
				if(channelsStartIdx>=0){
					var basicStr:String = (publicChannelMatchRst[0] as String).substr(channelsStartIdx);
					var basicChannelsObj:Object = JSON.decode(basicStr);
					channelInfo = basicChannelsObj;
				}
			}
			if(channelInfo==null){
				channelInfo = new Object();
			}
			(channelInfo.personal as Array).push({channels:[{channel_id:0,"name":"私人兆赫"}]});
			//TODO:DJ 频道
		}
	}
}